<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="com.baoku.wap.dao.*"  %>
<%@ page import="com.baoku.wap.entity.*" %>
<%@ page import="com.baoku.wap.util.*" %>
<%@ include file="session.jsp" %>
<%   int pageNo;
  	 try{
  	 	pageNo = Integer.parseInt(request.getParameter("pageNo"));
  	 }catch (Exception e){
  	 	pageNo = 1;
  	 }
  	 
  	 int id ;
  	 try{
  	 	id = Integer.parseInt(request.getParameter("id"));
  	 }catch (Exception e){
  	 	id = 1;
  	 }
  	 
  	 Iterator it = null;
  	 DateFactory factory = new DateFactory();
  	 ArrayList list = (ArrayList)factory.getComList(id,pageNo);
  	 it = list.iterator();
 %>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="Cache-control" content="no-cache"/>
<style type="text/css">
* { font-size:12px; }
body, div, p, img, form, input { margin:0; padding:0; line-height:22px; font-size:13px;}
a { text-decoration:none; }
a:hover, a:active, a:focus { text-decoration:underline; }
input { vertical-align:middle; line-height:22px; }
.logo{ height:25px;background:#CED7E6}
.login_nav { padding:2px 0 2px 5px; color:#fff; background:#811C40; border-top:1px solid #681432; border-bottom:1px solid #681432; }
.login_nav a { color:#fff; }
.qa_1 { padding:2px 0 2px 5px; background:#DDEBF9; border-bottom:1px dashed #BFD7EB;}
.qa_1 .a_q { color:#063456; }
.qa_1 .a_c { color:#0A8B00; }
.qa_2 { padding:2px 0 2px 5px; background:#EDF5FB; border-bottom:1px dashed #BFD7EB;}
.answer_2,.about { background:#EDF4FA; padding:2px 0 2px 5px; border-top:1px dotted #BED8E9;}
.about a{ color:#095A99;}
.inner_url { padding:2px 0 2px 5px; background:#DEECF9; }
.inner_url a { color:#065A98 }
textarea{ width:95%}
.com_title { padding:2px 0 2px 5px; color:#B3E2FE; background:#0E7A96; border-bottom:1px solid #0A5C71; border-top:1px solid #0A5C71; }
.about{ border-bottom:1px solid #C1D7EC;}
.go_back_2 a,.page a{color:#0E5589; }
.us_footer { background:#EDF5FB; color:#065A97; padding:2px 0 2px 5px; border-bottom:3px solid #0E6AAB; }
.us_footer a { color:#065A97; }
.footer { padding:2px 0 2px 5px; color:#065A97; background:url(images/bg_footer.jpg) repeat-x #E4F1FA; height:30px; }
.page {padding:2px 0 2px 5px; background:#fff;}
.go_back_2 {padding:2px 0 2px 5px; color:#0E5589; border-top:1px dashed #BFD7EB;}
.answer_2{ border-bottom:1px solid #C0D9ED;}
</style>
<title>宝酷网首页</title>
</head>
<body>
<div class="logo"><img src="images/logo.gif" alt="宝酷网" width="240" height="25" /></div>
<% if (login == false) {%> 
<div class="login_nav">[<a href="reg.jsp">免费注册</a>][<a href="login.jsp">登录</a>]</div>
<% } else { %>
<div class="login_nav">欢迎您:<%=(String)session.getAttribute("id") %> <br />
[<a href="mylist.jsp">我的收藏夹</a>][<a href="exit.jsp">退出</a>]</div>
<% } %>
<div class="qa_1"><img src="images/icon_list.gif" width="12" height="9" /><a href="#" class="a_c">&nbsp;<%=new DateFactory().getQuestion(id) %> </a></div>
<div class="com_title">
<% 
  	 
  	 if(factory.getCount()==0){
  	    out.print("对不起,没有相关评论!");
  	 }else{
  	 	out.print("最新评论("+factory.getCount()+"条)");
  	 }
%>
</div>
<%
	int i = 1;
	while(it.hasNext()){
		Commont com = (Commont)it.next();
%>
	<div <%if(i>0){
			out.print("class='qa_1'");
		   }else{
		    out.print("class='qa_2'");
		   }
		 %>>[<%=com.getUserid() %>]:<%=com.getCom() %></div>
<% i = i*(-1);}%>
<form class="page" action="com.jsp">
  <a href="com.jsp?id=<%=id %>&pageNo=<%=factory.getLastPage() %>">上一页</a>&nbsp;<a href="com.jsp?id=<%=id %>&pageNo=<%=factory.getNextPage()%>">下一页</a>&nbsp;<%=factory.getPageNo() %>/共<%=factory.getPageCount() %>页
  <p>
    <input name="id" value="<%=id %>" type="hidden" />
    <input name="pageNo" type="text" size="4" />
    &nbsp;
    <input name="input" type="image" src="images/btn_c.gif" />
  </p>
</form>

<div class="go_back_2">&gt;&gt;<a href="index.jsp">返回首页</a><br />
  &gt;&gt;<a href="inner.jsp?id=<%=id %>">返回问题页</a></div>
<form class="answer_2" action="docom.jsp">
  <p>我要评论</p>
  <input type="hidden" name="knowledgeid" value="<%=id %>"/>
  <textarea name="content" rows="2" ></textarea>
  <p>
    <input name="" type="image" src="images/btn_g.gif" />
  </p>
</form>
<div class="us_footer"><a href="#">在线帮助</a>&nbsp;<a href="#">关于我们</a></div>
<div class="footer">copyright</div>
</body>
</html>
